package com.googlecode.imanager.swing;

import com.googlecode.imanager.client.Container;
import com.googlecode.imanager.client.bridge.IContainer;
import com.googlecode.imanager.core.base.BridgeApplication;

/**
 * @author wellsantos@wellsantos.com
 * @since 0.01
 */
public abstract class SwingContainer extends SwingControl implements IContainer {

    //protected Insets insets;
    
    public SwingContainer(BridgeApplication bridge, Container source) {
        super(bridge, source);
        validateInsets();
    }

    @Override
    protected void defineLayout(){
        getTargetContainer().setLayout(null);
    }

    public java.awt.Container getTargetContainer() {
        return (java.awt.Container) target;
    }

    @Override
    public Container getSource() {
        return (Container) source;
    }

    public void validateInsets() {
        //getInsets();
        //getManager().setInsets(getSource(), insets.left, insets.top, insets.right, insets.bottom);
    }
    
    public void validateChildrenInsets(){/* FIXME
        for (Control control : getSource().getChildren()){
            IControl impl = Manager.getImpl(control);

            if (impl instanceof SwingContainer){
                SwingContainer c = (SwingContainer) impl;
                c.validateInsets();
                c.validateChildrenInsets();
            }
        }*/
    }

    /*public Insets getInsets() {
        return insets = getTarget().getInsets(insets);
    }*/

}
